<template>
  <div>
    <div class="header">
      <back></back>
      <span class="home">
        <router-link to="/">
          <i class="fa fa-home"></i>
        </router-link>
      </span>
    </div>
    <div class="myroot">
        <h2>{{content.title}}</h2>
        <p class="times">
          <i class="fa fa-history"></i>
          <span>{{content.time | times}}</span>
        </p>
    </div>
    <div id="content" class="myroot">
      <div v-html="art"></div>
    </div>
    <loading v-if="showLoading"></loading>
  </div>
</template>
<script>
  import Back from '../components/Back'
  import Loading from '../components/Loading'
  import '../filters.js'
  export default {
    data() {
      return {
        aid: "",
        content: {},
        art: "",
        showLoading:true
      }
    },
    components:{
        Back,Loading
    },
    methods: {

    },
    created() {
      this.aid = this.$route.params.artid
      this.axios.get('http://api.ishuhui.com/article/post/ver/f0161049/id/' + this.aid + '.json')
        .then(data => {
        //   console.log(data)
          this.content = data.data.data
          this.art = this.content.content.replace(/img src="\//g, 'img src="http://api.ishuhui.com/')
          this.art = this.art.replace(/img/g,'img style="width:100%"')
          this.art = this.art.replace(/670px/g,'100%')
          setTimeout(() => {
            this.showLoading = false
          },2000);
        //   console.log(typeof this.content.content)

        })
        .catch(err => {
          console.log(err)
        })
    },
    mounted() {
     
    }
  }

</script>
<style scoped>

  .myroot{
      padding: 0 15px;
      text-align: center;
  }
  .header {
    background-color: #35495e;
    color: white;
    position: fixed;
    width: 100%;
    top: 0;
    height: 44px;
    line-height: 44px;
    z-index: 10;
  }

  .home{
    float: right;
    margin-right: 20px;
  }
  .home a{
    color: white;
    font-size: .5rem;
  }
  h2{
      text-align: center;
      
  }
  .times{
    margin-top: 10px;
  }
  #content {
    width: 100%;
    
  }
  
  .tvp_overlay_poster{
    width: 100%;
  }

</style>
